	Event.observe(window, 'load', function() {
	
		Ajax.Responders.register({
			onCreate: function() {
				if($('notification') && Ajax.activeRequestCount > 0)
					Effect.Appear('notification',{duration: 0.25, queue: 'end'});
			},
			onComplete: function() {
				if($('notification') && Ajax.activeRequestCount == 0)
					Effect.Fade('notification',{duration: 0.25, queue: 'end'});
			}
		});
	
		$$( 'tr.item' ).each( function ( el ) {
			el.observe( 'click', getInfo );
		});
		

	});
	
	var fStatus = '';

	function getInfo( el ) {
		
		var bestellingId =  this.id.split("_")[1];
		if ( $('info_' + bestellingId) ) {
			$('info_' + bestellingId).hide();
			$('info_' + bestellingId).remove();
			$('detail_' + bestellingId).hide();
			$('item_' + bestellingId).setStyle( { backgroundColor: '#FFFFFF' } );
			/*
			Effect.BlindUp ( $('info_' + bestellingId), { 
				duration: 0.5, 
				afterFinish: function ( ) { 
					$('info_' + bestellingId).remove();
					$('detail_' + bestellingId).hide();
					$('item_' + bestellingId).setStyle( { backgroundColor: '#FFFFFF' } );
				}
			});
			*/
		} else {
		  new Ajax.Request( "ajax/getBestellingDetail.php",
		    {
				method: 'post',
				parameters: { id: bestellingId },
				onSuccess: function( response ) {
						$('item_' + bestellingId).setStyle( { backgroundColor: '#EEEEEE' } );
						var html = response.responseText;
						var tr = new Element( 'tr', { 'class': 'detail', id: 'detail_' + bestellingId } );
						var td = new Element( 'td', { colspan: '6', 'class': 'detailtd', id: 'infoplaceholder_' + bestellingId} ).update( html );
						tr.update( td );
						Element.insert($('item_' + bestellingId), {after: tr});
						$('info_' + bestellingId).show();
						//Effect.BlindDown ( $('info_' + bestellingId), { duration: 1 } );
		      }
		    }
			);
		}
	}